package pro.shushi.pamirs.demo.api.model;

import pro.shushi.pamirs.boot.base.ux.annotation.field.UxWidget;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxDetail;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxForm;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxTable;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxTableSearch;
import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.IdModel;
import pro.shushi.pamirs.meta.enmu.NullableBoolEnum;

import java.util.List;


@Model.model(Cruise.MODEL_MODEL)
@Model(displayName = "船舶", labelFields = "name")
@Model.Advanced(index = {"name"})
public class Cruise extends IdModel {

    private static final long serialVersionUID = -5104390780952631397L;

    public static final String MODEL_MODEL = "demo.Cruise";

    @UxTableSearch.FieldWidget(@UxWidget())//支持搜索
    @Field.String
    @Field(displayName = "名称", required = true)
    private String name;

    @Field.String
    @Field(displayName = "英文名称")
    private String englishName;

    @Field.Text
    @Field(displayName = "描述")
    private String description;

    //Ux主要是默认生成的页面DSL需要配置注解，如果是用界面配置则不需要配置
    @UxForm.FieldWidget(@UxWidget(widget = "UploadImg"))
    @UxTable.FieldWidget(@UxWidget(widget = "UploadImg"))
    @UxDetail.FieldWidget(@UxWidget(widget = "UploadImg"))
    @Field.Advanced(columnDefinition = "varchar(4096)")
    @Field(displayName = "图片", multi = true, required = true,
            serialize = Field.serialize.COMMA, store = NullableBoolEnum.TRUE)
    private List<String> fileImages;

    @Field.one2many
    @Field.Relation(relationFields = "id",referenceFields = "cruiseId")
    @Field(displayName = "房类型", required = true)
    private List<RoomType> roomTypes;

}
